<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:t="http://myfaces.apache.org/tomahawk">

<ui:composition template="layout/layout.xhtml">
	<ui:define name="menu">
		<ui:include src="layout/menu_admin.xhtml" />
	</ui:define>
	<ui:define name="content">
		<f:view locale="#{LocalizationController.locale}">
			<a4j:form ajaxSubmit="true"
				reRender="groupList,scrollValidationDown,scroll_1_div">

				<h3 style="display:inline-block;"><h:outputText value="#{msgs.Admin20Title}"/></h3>
				<h:commandLink styleClass="btn btn-success pull-right" value="#{msgs.Admin21CreateGroup}" action="#{GroupAdminController.createGroup}" />

				<t:dataTable id="groupList" var="group" styleClass="table table-striped"
					value="#{GroupAdminController.dataModel}" preserveDataModel="false"
					rows="#{GroupAdminController.rowsPerPage}" style="margin-top:20px;">

					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.Common23Name}" />
						</f:facet>
						<h:outputText value="#{group.name}" />
					</h:column>

					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.Common31Description}" />
						</f:facet>
						<h:outputText value="#{group.description}" />
					</h:column>

					<h:column>
						<f:facet name="header">
							<h:outputText styleClass="headerText" value="#{msgs.Admin5Actions}" />
						</f:facet>
						<a4j:commandLink ajaxSingle="true" id="viewlink" style="margin-left: 10px;"
							action="#{GroupAdminController.viewGroupDetails}">
							<i class="icon-folder-open icon-2x"></i>
						</a4j:commandLink>
						<rich:toolTip for="viewlink" value="#{msgs.Admin6ActionDetails}" />
						<a4j:commandLink ajaxSingle="true" id="trashlink5" oncomplete="#{rich:component('deletePanel')}.show()">
							<i class="icon-trash icon-2x"></i>
							<a4j:actionparam name="idGroupToDelete" value="#{group.id}" assignTo="#{GroupAdminController.groupToDelete}" />
						</a4j:commandLink>
						<rich:toolTip for="trashlink5" value="#{msgs.Common2Cancel}" />
					</h:column>

				</t:dataTable>

				<t:div id="scroll_1_div">
					<t:dataScroller id="scrollValidationDown" for="groupList"
						fastStep="10" pageCountVar="pageCount" pageIndexVar="scrollerPage"
						paginator="true" paginatorMaxPages="9" immediate="true"
						rendered="#{UserAdminController.dataSize gt 10}">

						<f:facet name="first">
							<h:graphicImage url="img/first.png" />
						</f:facet>

						<f:facet name="last">
							<h:graphicImage url="img/last.png" />
						</f:facet>

						<f:facet name="previous">
							<h:graphicImage url="img/previous.png" />
						</f:facet>

						<f:facet name="next">
							<h:graphicImage url="img/next.png" />
						</f:facet>


					</t:dataScroller>
				</t:div>

				<rich:modalPanel id="deletePanel" autosized="true" width="250">
					<f:facet name="header">
						<h:outputText value="#{msgs.Admin27DeleteQuestion}" />
					</f:facet>
					<br />
					<table width="100%">
						<tbody>
							<tr>
								<td align="center" width="20%">
									<i class="icon-warning-sign icon-3x red"></i>
								</td>
								<td align="center" width="40%">
									<a4j:commandLink value="#{msgs.Admin71Delete}" styleClass="inputBtn inputBtn-blue"
										oncomplete="#{rich:component('deletePanel')}.hide();return true;"
										action="#{GroupAdminController.deleteGroup}" />
								</td>
								<td align="center" width="40%">
									<a4j:commandLink
										value="#{msgs.Admin72Cancel}" styleClass="inputBtn inputBtn-grey"
										onclick="#{rich:component('deletePanel')}.hide();return false;" />
								</td>
							</tr>
						</tbody>
					</table>
				</rich:modalPanel>
			</a4j:form>
		</f:view>
	</ui:define>
</ui:composition>
</html>